#!/bin/sh

PATH=/sbin:/bin:/usr/bin:/usr/sbin:/opt/bin:/opt/sbin

if grep -q ^eggdrop: /etc/group; then
	echo There already is an eggdrop group on the system.
	ADDUSER_OPT="-G eggdrop"
fi

if grep -q ^eggdrop: /etc/passwd; then
	echo There already is an eggdrop user on the system.
else
	echo -n "No eggdrop user found, creating it... "
	adduser -S -h /opt/share/eggdrop -g "eggdrop daemon" -s /bin/false -D -H  $ADDUSER_OPT eggdrop > /dev/null 2>&1
	echo done
fi
chown -R eggdrop.eggdrop /opt/share/eggdrop
chmod 700 /opt/share/eggdrop

echo ; echo
echo "A template configuration file is installed here : /opt/etc/eggdrop.conf"
echo "Please read the eggdrop documentation to create a configuration file matching you needs."
echo

